﻿using System;
using Microsoft.Practices.Composite.Events;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace StockholmsStad.Windows.UI.Modules.MainModule.Models
{
    public class ToolBarPresentationModel
    {
        public event EventHandler<DataEventArgs<ToolBarPresentationModel>> Toggled;
        public DelegateCommand<string> ToggleCommand { get; private set; }

        public ToolBarPresentationModel()
        {
            ToggleCommand = new DelegateCommand<string>(Toggle);
        }

        #region Properties

        public bool IsVisible { get; set; }

        #endregion

        private void Toggle(object obj)
        {
            OnToggled(new DataEventArgs<ToolBarPresentationModel>(this));
        }

        private void OnToggled(DataEventArgs<ToolBarPresentationModel> e)
        {
            var toggledHandler = Toggled;

            if (toggledHandler != null)
                toggledHandler(this, e);
        }
    }
}
